<html>
<head><meta charset="utf-8"><title>issue-51641-n-squared-lint-loop · t-compiler/wg-nll · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/index.html">t-compiler/wg-nll</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html">issue-51641-n-squared-lint-loop</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="128326507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128326507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128326507">(Jun 19 2018 at 20:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> I wrote up some mentoring instructions <a href="https://github.com/rust-lang/rust/issues/51641#issuecomment-398534351" target="_blank" title="https://github.com/rust-lang/rust/issues/51641#issuecomment-398534351">on issue #51641</a></p>



<a name="128326513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128326513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128326513">(Jun 19 2018 at 20:31)</a>:</h4>
<p>let me know if they make sense :)</p>



<a name="128326562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128326562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128326562">(Jun 19 2018 at 20:32)</a>:</h4>
<p>oh awesome thank you, I will surely need them :)</p>



<a name="128326799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128326799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128326799">(Jun 19 2018 at 20:37)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yeah makes sense :)</p>



<a name="128363215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128363215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128363215">(Jun 20 2018 at 13:45)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> hello :) couple note/questions: <br>
- I was going to 1st remove the quadratic loop like you suggested in the instructions, before looking at gathering information on what it fixes, and how to do that in another existing walk or else, is that ok ?<br>
- do I need to do anything with <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/util/collect_writes.rs#L60-L61" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/util/collect_writes.rs#L60-L61">these TODOs</a> in our new visitor ? copy these comments ?<br>
- I assume I should put the visitor in borrow_check/mod.rs ?<br>
- I planned on adding a method to the MirBorrowckContext to find the used muts, however it's divided into 3 impls in this file, should I just put my method in the 1st one ? :)<br>
- my planned visitor looks like the following, does this match what you were expecting ?</p>
<div class="codehilite"><pre><span></span>struct FindUsedMutsVisitor&lt;&#39;visit, &#39;cx: &#39;visit, &#39;gcx: &#39;tcx, &#39;tcx: &#39;cx&gt; {
    needles: FxHashSet&lt;Local&gt;,
    mbcx: &amp;&#39;visit mut MirBorrowckCtxt&lt;&#39;cx, &#39;gcx, &#39;tcx&gt;,
}
</pre></div>


<ul>
<li>if the previous answer is yes, then the bulk of the work is done, and I'm seeing the numbers we expected on clap</li>
</ul>



<a name="128363811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128363811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128363811">(Jun 20 2018 at 13:57)</a>:</h4>
<p>first, I would put the new code in a submodule :)</p>



<a name="128363819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128363819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128363819">(Jun 20 2018 at 13:57)</a>:</h4>
<blockquote>
<p>before looking at gathering information on what it fixes, and how to do that in another existing walk or else, is that ok ?</p>
</blockquote>
<p>yes, definitely</p>



<a name="128363865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128363865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128363865">(Jun 20 2018 at 13:58)</a>:</h4>
<blockquote>
<ul>
<li>do I need to do anything with these TODOs in our new visitor ? copy these comments ?</li>
</ul>
</blockquote>
<p>meh, just delete. Not sure why that's even there.</p>



<a name="128363888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128363888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128363888">(Jun 20 2018 at 13:59)</a>:</h4>
<blockquote>
<ul>
<li>I planned on adding a method to the MirBorrowckContext to find the used muts, however it's divided into 3 impls in this file, should I just put my method in the 1st one ? :)</li>
</ul>
</blockquote>
<p>I'm not sure I understand.. I think the answer though is:</p>
<ul>
<li>You should make a new module and put visitor etc in there</li>
<li>Add a "wrapper method" that creates the visitor and does the walk, which is the public thing from the file</li>
</ul>
<p>sort of:</p>
<div class="codehilite"><pre><span></span><span class="c1">// new_mod.rs</span>
<span class="k">impl</span><span class="w"> </span><span class="n">MirBorrowckCtxt</span><span class="o">&lt;</span><span class="p">..</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">crate</span><span class="w"> </span><span class="k">fn</span> <span class="nf">gather_stuff</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">Visitor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Visitor</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Visitor</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">MirVisitor</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Visitor</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="128363892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128363892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128363892">(Jun 20 2018 at 13:59)</a>:</h4>
<p>that visitor looks about right yes</p>



<a name="128363995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128363995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128363995">(Jun 20 2018 at 14:01)</a>:</h4>
<p>what I mean with the 3 impls is this: 1) <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L793" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L793">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L793</a> 2) <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L1394" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L1394">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L1394</a> and 3) <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L2139" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L2139">https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L2139</a></p>



<a name="128364173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128364173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128364173">(Jun 20 2018 at 14:05)</a>:</h4>
<p>so I was wondering why MirBorrowckCtxt was split in 3, but I guess it's for readability</p>



<a name="128366056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366056">(Jun 20 2018 at 14:48)</a>:</h4>
<p>I personally think <code>borrow_check/mod.rs</code> has grown way beyond the size it should have :)</p>



<a name="128366062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366062">(Jun 20 2018 at 14:48)</a>:</h4>
<p>but often we do divide up methods by "theme"</p>



<a name="128366065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366065">(Jun 20 2018 at 14:48)</a>:</h4>
<p>I tend to prefer do that in distinct modules</p>



<a name="128366068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366068">(Jun 20 2018 at 14:48)</a>:</h4>
<p>not within one file :)</p>



<a name="128366074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366074">(Jun 20 2018 at 14:48)</a>:</h4>
<p>my guess is that those 3 impls arose...organically, let's say</p>



<a name="128366077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366077">(Jun 20 2018 at 14:48)</a>:</h4>
<p>I think this code is somewhat in need of reorg</p>



<a name="128366086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366086">(Jun 20 2018 at 14:48)</a>:</h4>
<p>it's been evolving a lot and with a lot of distinct people doing PRs etc =)</p>



<a name="128366096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366096">(Jun 20 2018 at 14:49)</a>:</h4>
<p>:)</p>



<a name="128366099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366099">(Jun 20 2018 at 14:49)</a>:</h4>
<p>that said, no reason to add to it</p>



<a name="128366100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366100">(Jun 20 2018 at 14:49)</a>:</h4>
<p>hence my suggestion to isolate your changes to a distinct module</p>



<a name="128366105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366105">(Jun 20 2018 at 14:49)</a>:</h4>
<p>they seem like a coherent unit to me...</p>



<a name="128366108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366108">(Jun 20 2018 at 14:49)</a>:</h4>
<p>would <code>used_muts.rs</code> be a good name ? so that maybe in the future we can move the rest of the used mut lint there ?</p>



<a name="128366111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366111">(Jun 20 2018 at 14:49)</a>:</h4>
<p>+1</p>



<a name="128366113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366113">(Jun 20 2018 at 14:49)</a>:</h4>
<p>yeah, something like that</p>



<a name="128366164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366164">(Jun 20 2018 at 14:50)</a>:</h4>
<p>I think in my ideal world there'd be a <code>used_mut</code> submodule with (probably) multiple further submodules</p>



<a name="128366167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366167">(Jun 20 2018 at 14:50)</a>:</h4>
<p>since I suspect there's enough complex logic that it merits it</p>



<a name="128366170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366170">(Jun 20 2018 at 14:50)</a>:</h4>
<p>but anyway</p>



<a name="128366184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128366184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128366184">(Jun 20 2018 at 14:51)</a>:</h4>
<p>yeah rn the module is 60 lines or so -- I think I'm almost done</p>



<a name="128370205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128370205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128370205">(Jun 20 2018 at 16:16)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I have to go now  but here is the PR <a href="https://github.com/rust-lang/rust/pull/51660" target="_blank" title="https://github.com/rust-lang/rust/pull/51660">https://github.com/rust-lang/rust/pull/51660</a></p>



<a name="128372208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128372208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128372208">(Jun 20 2018 at 17:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> I was wondering if we needed a perf run, so thanks for the try build :)</p>



<a name="128372262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128372262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128372262">(Jun 20 2018 at 17:04)</a>:</h4>
<p>Don't need it but can't hurt.</p>



<a name="128374936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128374936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128374936">(Jun 20 2018 at 18:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> I left one minor nit but looks good</p>



<a name="128375348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128375348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128375348">(Jun 20 2018 at 18:16)</a>:</h4>
<p>oh the match on the PlaceContext ok</p>



<a name="128375599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128375599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128375599">(Jun 20 2018 at 18:20)</a>:</h4>
<p>maybe there’s already a similar fn somewhere checking if a Place is an assignment ?</p>



<a name="128375874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128375874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128375874">(Jun 20 2018 at 18:27)</a>:</h4>
<p>I feel like .. sort of maybe? check the liveness code perhaps?</p>



<a name="128375928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128375928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128375928">(Jun 20 2018 at 18:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> I was thinking of <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/util/liveness.rs#L229-L229" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/util/liveness.rs#L229-L229">this fn</a></p>



<a name="128376497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128376497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128376497">(Jun 20 2018 at 18:39)</a>:</h4>
<p>thanks, I will check it out once I’m back to the computer</p>



<a name="128385092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128385092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128385092">(Jun 20 2018 at 21:34)</a>:</h4>
<p>if I extracted matching <code>PlaceContext::Call</code> and <code>PlaceContext::Store</code> into a separate fn used by <code>collect_writes</code>, <code>used_muts</code>, and <code>liveness:categorize</code>, I wouldn't know where to keep <a href="https://github.com/rust-lang/rust/blob/637fd2e0487281adac99000602f5e74c3bf151a8/src/librustc_mir/util/liveness.rs#L239-L246" target="_blank" title="https://github.com/rust-lang/rust/blob/637fd2e0487281adac99000602f5e74c3bf151a8/src/librustc_mir/util/liveness.rs#L239-L246">this comment</a> which seems important if in the future the success and unwind paths are handled differently ?</p>



<a name="128385977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128385977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128385977">(Jun 20 2018 at 21:55)</a>:</h4>
<p>I can at the very least share the whole thing with <code>find_assignments</code> easily</p>



<a name="128386040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128386040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128386040">(Jun 20 2018 at 21:56)</a>:</h4>
<p>maybe just do that for now... though I think you could just call the def/use categorizer as is</p>



<a name="128386044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128386044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128386044">(Jun 20 2018 at 21:56)</a>:</h4>
<p>and look for Defs</p>



<a name="128386046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128386046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128386046">(Jun 20 2018 at 21:56)</a>:</h4>
<p>and consider that to be an assignment</p>



<a name="128386050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128386050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128386050">(Jun 20 2018 at 21:56)</a>:</h4>
<p>and leave the comment where it is :)</p>



<a name="128386083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128386083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128386083">(Jun 20 2018 at 21:57)</a>:</h4>
<p>even if collect_writes didn't look for AsmOutput or Storage* ?</p>



<a name="128386091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128386091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128386091">(Jun 20 2018 at 21:57)</a>:</h4>
<p>if so, <span class="emoji emoji-1f44d" title="thumbs up">:thumbs_up:</span></p>



<a name="128386432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128386432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128386432">(Jun 20 2018 at 22:05)</a>:</h4>
<p>(oh maybe you meant calling the categorizer in used_mut only)</p>



<a name="128408213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408213">(Jun 21 2018 at 09:12)</a>:</h4>
<blockquote>
<p>even if collect_writes didn't look for AsmOutput or Storage* ?</p>
</blockquote>
<p>hmm, <code>AsmOutput</code> seems ok -- maybe even a bug that we were ignored it -- but the storage stuff is a bit questionable</p>



<a name="128408219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408219">(Jun 21 2018 at 09:12)</a>:</h4>
<p>tbh <code>StorageDead</code> and friends don't seem like a "def" or a "use"</p>



<a name="128408388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408388">(Jun 21 2018 at 09:17)</a>:</h4>
<p>I think we don't really need collect_writes really, it might have been made for that loop mostly. Where <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L1873-L1875" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/borrow_check/mod.rs#L1873-L1875">it's used</a> it only needs the first location</p>



<a name="128408485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408485">(Jun 21 2018 at 09:19)</a>:</h4>
<p>what is <code>collect_writes</code>?</p>



<a name="128408487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408487">(Jun 21 2018 at 09:19)</a>:</h4>
<p>do you mean <code>find_assignments</code>?</p>



<a name="128408540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408540">(Jun 21 2018 at 09:20)</a>:</h4>
<p>yeah find_assignments, which is in  util/collect_writes.rs</p>



<a name="128408563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408563">(Jun 21 2018 at 09:20)</a>:</h4>
<p>hmm. maybe so. I'm not convinced that ignoring other writes is correct in that code...maybe it is...</p>



<a name="128408572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408572">(Jun 21 2018 at 09:21)</a>:</h4>
<p>but it seems like in general it's a footgun to walk ALL the IR</p>



<a name="128408600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408600">(Jun 21 2018 at 09:21)</a>:</h4>
<p>yeah</p>



<a name="128408836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408836">(Jun 21 2018 at 09:25)</a>:</h4>
<p>I'd be ok with changing to <code>find_some_assignment</code> or something like that</p>



<a name="128408848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408848">(Jun 21 2018 at 09:25)</a>:</h4>
<p>I'm not sure finding storage* locations in the single use of find_assignment will have no impact so I'm not sure what to do about that. I was in the meantime running the tests on using the categorizer only in the new gather_used_mut</p>



<a name="128408944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408944">(Jun 21 2018 at 09:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> btw  <a href="http://perf.rust-lang.org/compare.html?start=637fd2e0487281adac99000602f5e74c3bf151a8&amp;end=737c5cc95040e9efce65cb13a51a0df0f842cef4&amp;stat=instructions%3Au" target="_blank" title="http://perf.rust-lang.org/compare.html?start=637fd2e0487281adac99000602f5e74c3bf151a8&amp;end=737c5cc95040e9efce65cb13a51a0df0f842cef4&amp;stat=instructions%3Au">http://perf.rust-lang.org/compare.html?start=637fd2e0487281adac99000602f5e74c3bf151a8&amp;end=737c5cc95040e9efce65cb13a51a0df0f842cef4&amp;stat=instructions%3Au</a></p>



<a name="128408994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408994">(Jun 21 2018 at 09:28)</a>:</h4>
<p>I think <span class="user-mention" data-user-id="116113">@lqd</span> it's fine to just have two methods for now</p>



<a name="128408995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408995">(Jun 21 2018 at 09:28)</a>:</h4>
<p>that is, we don't <em>have</em> to consolidate with the helper from liveness</p>



<a name="128408997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408997">(Jun 21 2018 at 09:28)</a>:</h4>
<p>it feels like a separate PR</p>



<a name="128408999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128408999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128408999">(Jun 21 2018 at 09:28)</a>:</h4>
<p>ok yeah</p>



<a name="128409001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128409001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128409001">(Jun 21 2018 at 09:28)</a>:</h4>
<p>also, nice results</p>



<a name="128409005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128409005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128409005">(Jun 21 2018 at 09:29)</a>:</h4>
<p>maybe as a later phase when we can consolidate into another walk</p>



<a name="128409014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128409014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128409014">(Jun 21 2018 at 09:29)</a>:</h4>
<p>I tried removing the loop and it seemed like only <a href="https://github.com/rust-lang/rust/blob/master/src/test/run-pass/issue-16671.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/test/run-pass/issue-16671.rs">this test</a> failed</p>



<a name="128409152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128409152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128409152">(Jun 21 2018 at 09:33)</a>:</h4>
<p>so something like a <code>is_place_assignment</code> in util/collect_writes.rs would be ok ?</p>



<a name="128409639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128409639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128409639">(Jun 21 2018 at 09:45)</a>:</h4>
<p>sounds good</p>



<a name="128411821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128411821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128411821">(Jun 21 2018 at 10:52)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I should also make this fn say AsmOutput is an assignment shouldn't I, here it's like a Store to me</p>



<a name="128414684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128414684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128414684">(Jun 21 2018 at 12:14)</a>:</h4>
<p>so I did that and pushed the shared function to <a href="https://github.com/rust-lang/rust/pull/51660" target="_blank" title="https://github.com/rust-lang/rust/pull/51660">https://github.com/rust-lang/rust/pull/51660</a> :)</p>



<a name="128466843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128466843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128466843">(Jun 22 2018 at 10:47)</a>:</h4>
<p>sweet, the PR landed</p>



<a name="128474694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop/near/128474694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/issue-51641-n-squared-lint-loop.html#128474694">(Jun 22 2018 at 14:10)</a>:</h4>
<p>nice</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>